import time

from selenium.webdriver.common.by import By
from buxi3.Base import Base
class Page(Base):
    #定位器
    sousuobtn_loc=(By.CLASS_NAME,'chat-input-textarea.chat-input-scroll-style')
    #封装页面
    def sousuobtn(self):
        self.send_keys(self.sousuobtn_loc,"军事")
    baidubtn_loc=(By.XPATH,'/html/body/div/div[3]/div[3]/div[1]/div/div[2]/div/div/div/div/div[1]/div[4]/div[1]/div[3]/div[3]/button')
    def baidubtn(self):
        self.click(self.baidubtn_loc)
    neirong_loc=(By.XPATH,'//*[@id="1"]/div/div/div/div[1]/div/h3/a/div/div/p/span/span/span')
    dy1_loc=(By.CSS_SELECTOR,'.cosc-title-slot')
    def dy1(self):
        self.text(self.dy1_loc)
    def neirong(self):
        self.click(self.neirong_loc)
    #业务逻辑
    def luoji_baidu(self):
        self.goto("https://www.baidu.com/")
        self.driver.implicitly_wait(2)
        self.driver.refresh()
        self.sousuobtn()
        time.sleep(2)
        self.baidubtn()
        time.sleep(2)
        print(self.dy1())
        self.neirong()
        time.sleep(2)
